local baseMatrix = require("app.views.matrix")
local M = class("MatrixLeft", baseMatrix)

function M:ctor()
    self.super.ctor(self)
end

function M:runFadeOutAni()
    local duration = 0.5
    for i=1,#self.m_girds do
        local ani = cc.FadeOut:create(duration)
        self.m_girds[i]:runAction(ani)
    end
    return self
end

function M:showGirds()
    self:updateMatrix()
    for i=1,#self.m_girds do
        local ani = transition.sequence{cc.FadeOut:create(0),cc.Show:create(),cc.FadeIn:create(0.2)}
        self.m_girds[i]:runAction(ani)
    end
    return self
end

function M:runBlink()
    for i=1,#self.m_girds do
        local ani = transition.sequence{cc.Show:create(),cc.FadeOut:create(0.5),cc.FadeIn:create(0.5)}
        self.m_girds[i]:runAction(ani)
    end
    return self
end

function M:updateMatrix()
    -- print("更新左边矩阵")
    for i=1,#self.m_data do
        local gird = self.m_girds[i]
        if self.m_data[i]==0 then 
            self:setTex_X(gird)
        else
            self:setTex_O(gird)
        end
    end
    return self
end

function M:reset()
    for i=1,#self.m_girds do
        self.m_girds[i]:opacity(255)
    end
end

function M:onEnter()

end

function M:onExit()

end

return M